//
//  AJTTStoryDetailsController.swift
//  JourneyThroughTime
//
//  Created by iOS-Czz on 2023/11/6.
//

import UIKit

class AJTTStoryDetailsController: AJTTBaseViewController {

    @IBOutlet var contentLabel: UILabel!
    @IBOutlet var headLabel: UILabel!
    @IBOutlet var dateLabel: UILabel!
    @IBOutlet var nameLabel: UILabel!
    @IBOutlet var coverImage: UIImageView!
    var model:AJTTStoryModel = AJTTStoryModel()
    override func viewDidLoad() {
        super.viewDidLoad()
        self.setPageData()
        // Do any additional setup after loading the view.
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.wx_navigationBar.isHidden = true
    }
    func setPageData(){
        self.nameLabel.text = self.model.name
        self.dateLabel.text = self.model.date
        self.coverImage.image = UIImage.loadImage(self.model.picture)
        if self.model.content.count > 150 {
            self.headLabel.text = String(self.model.content.prefix(150))
            self.contentLabel.text = String(self.model.content.suffix(from: self.model.content.index(self.model.content.startIndex, offsetBy: 150)))
        }else{
            self.headLabel.text = self.model.content
            self.contentLabel.text = ""
        }
    }

    @IBAction func clickBackAction(_ sender: Any) {
        self.navigationController?.popViewController(animated: true)
    }
    
    
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
